package lc_2101_引爆最多的炸弹;

import java.nio.CharBuffer;
import java.util.Arrays;
import java.util.BitSet;

public class Solution {

	public int maximumDetonation(int[][] bombs) {
		int n = bombs.length;
		BitSet[] bss = new BitSet[n];
		for (int i = 0; i < n; i++) {
			int x = bombs[i][0], y = bombs[i][1], r = bombs[i][2];
			bss[i] = new BitSet(n);
			for (int j = 0; j < n; j++) {
				int X = bombs[j][0] - x, Y = bombs[j][1] - y;
				if (1l * X * X + 1l * Y * Y <= 1l * r * r) {
					bss[i].set(j);
				}
			}
		}
		for (int k = 0; k < n; k++) {
			for (int i = 0; i < n; i++) {
				if (bss[i].get(k)) {
					bss[i].or(bss[k]);
				}
			}
		}
		return Arrays.stream(bss).mapToInt(s -> s.cardinality()).max().getAsInt();
	}

	public static void main(String[] args) {
		Solution so = new Solution();
		String case1 = "[[1,1,100000],[100000,100000,1]]";
//		String case2 = "[[54,95,4],[99,46,3],[29,21,3],[96,72,8],[49,43,3],[11,20,3],[2,57,1],[69,51,7],[97,1,10],[85,45,2],[38,47,1],[83,75,3],[65,59,3],[33,4,1],[32,10,2],[20,97,8],[35,37,3]]";
//		parseString(case1);
	}

	public static int[][] parseString(String input) {
		return null;
	}


}